package com.fitso.model.service.food.journal;

import javax.annotation.Resource;

import org.joda.time.DateTime;
import org.springframework.stereotype.Service;

import com.fitso.model.bean.User;
import com.fitso.model.bean.journal.FoodJournal;
import com.fitso.model.dao.FoodJournalDao;

@Service("SimpleFoodJournalService")
public class SimpleFoodJournalService implements FoodJournalService {

	@Resource(name = "HibernateFoodJournalDao")
	private FoodJournalDao _foodJournalDao;

	@Override
	public FoodJournal fetch(User user, DateTime date) {
		return _foodJournalDao.read(user, date);
	}

	@Override
	public void delete(FoodJournal foodJournal) {
		_foodJournalDao.delete(foodJournal);
	}

	@Override
	public void edit(FoodJournal foodJournal) {
		_foodJournalDao.createOrUpdate(foodJournal);
	}

	@Override
	public void save(FoodJournal foodJournal) {
		_foodJournalDao.createOrUpdate(foodJournal);
	}
}
